package Day18;

import java.io.File;
import java.io.IOException;
import java.text.ParseException;

public class Demo01 {
    public static void main(String[] args) throws IOException, ParseException {
        //IO图书馆
        Book b = new Book();
        View v = new View();
        DoBook d = new DoBook();
        boolean login = d.login(v.account(), v.password());
        if(login == true) {//登录
            while (true) {
                int a = v.xxx();
                switch (a) {
                    case 1: {//图书增加
                        boolean f = d.add(v.add());
                        if(f == true){
                            System.out.println("添加成功");
                        }else{
                            System.out.println("添加失败");
                        }
                        break;
                    }
                    case 2: {//修改
                        boolean r = d.revise(v.reviseBook());
                        if(r == true){
                            System.out.println("修改成功");
                        }else{
                            System.out.println("修改失败");
                        }
                        break;
                    }
                    case 3:{//删除
                        boolean delete = d.delete(v.deleteBook());
                        if(delete == true){
                            System.out.println("删除成功");
                        }else{
                            System.out.println("删除失败");
                        }
                        break;
                    }
                    case 4:{//查找
                        Book f = d.find(v.findBook());
                        System.out.println(f.toString());
                        break;
                    }
                    case 5:{//遍历
                        d.printAll();
                        break;
                    }
                    case 0:{//退出
                        return;
                    }
                }
            }
        }else{
            System.out.println("登陆失败");
        }
    }
}
